function Shape() {
    this.X = 0;
    this.Y = 0;

    this.move = function (x, y) {
        this.X = x;
        this.Y = y;
    }
    this.distance_from_origin = function () {
        return Math.sqrt(this.X * this.X + this.Y * this.Y);
    }
}

var s = new Shape();
s.move(10, 10);
console.log(s.distance_from_origin());

var s1 = new Shape(15, 35);
s1.FillColour = "red";
console.log(s1.FillColour);

console.log("========================extends========================")

Shape.prototype.X = 0;
Shape.prototype.Y = 0;

Shape.prototype.move = function (x, y) {
    this.X = x;
    this.Y = y;
}
Shape.prototype.distance_from_origin = function () {
    return Math.sqrt(this.X * this.X + this.Y * this.Y);
}
Shape.prototype.area = function () {
    throw new Error("I don't have a form yet");
}
var s2 = new Shape();
s2.move(10, 10);
console.log(s2.distance_from_origin());

function Square() {
}

Square.prototype = new Shape();
Square.prototype.__proto__ = Shape.prototype;
Square.prototype.Width = 0;

Square.prototype.area = function () {
    return this.Width * this.Width;
}
var sq = new Square();
sq.move(-5, -5);
sq.Width = 5;
console.log(sq.area());
console.log(sq.distance_from_origin());